package org.springblade.modules.repair.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;

import javax.validation.constraints.Max;

/**
 * 2024-03-08 新增 救援大屏配置类
 * @author: Sharry
 * @createTime: 2024-03-08 10:11
 * @version: Version-1.0
 */
@JsonIgnoreProperties(ignoreUnknown = true) // 允许反序列化时忽略未知字段
@Data
public class RescueScreenConfig {
	/**
	 * 自行车
	 */
	@Max(value = 100, message = "请输入不大于100的数值")
	private Double bicycle;

	/**
	 * 摩托车
	 */
	@Max(value = 100, message = "请输入不大于100的数值")
	private Double motorcycle;

	/**
	 * 电动车
	 */
	@Max(value = 100, message = "请输入不大于100的数值")
	private Double electricVehicle;

	/**
	 * 汽车
	 */
	@Max(value = 100, message = "请输入不大于100的数值")
	private Double car;

	/**
	 * 公交车
	 */
	@Max(value = 100, message = "请输入不大于100的数值")
	private Double bus;

	/**
	 * 其它
	 */
	@Max(value = 100, message = "请输入不大于100的数值")
	private Double other;

	/**
	 * 阈值
	 */
	private Double rescueTimeOut;

	/**
	 * 未及时调度阈值
	 */
	private Double overtimeNotDispatch;

	/**
	 * 未及时出发阈值
	 */
	private Double overtimeNotDepart;

	/**
	 * 未及时出发移动距离（km）阈值
	 */
	private Double notDepartMove;


	// 构造方法，默认所有属性值都为5
	public RescueScreenConfig() {
		this.bicycle = 5.0;
		this.motorcycle = 5.0;
		this.electricVehicle = 5.0;
		this.car = 5.0;
		this.bus = 5.0;
		this.other = 5.0;
		this.rescueTimeOut = 5.0;
		this.overtimeNotDispatch = 2.0;
		this.overtimeNotDepart = 5.0;
		this.notDepartMove = 1.0;
	}

	/**
	 * 接收参数的构造方法，当有部分值缺失时赋值默认为5
	 */
	public RescueScreenConfig(Integer bicycle, Integer motorcycle, Integer electricVehicle, Integer car, Integer bus, Integer other, Integer rescueTimeOut, Integer overtimeNotDispatch, Integer overtimeNotDepart, Double notDepartMove) {
		this.bicycle = (bicycle != null) ? bicycle : 5.0;
		this.motorcycle = (motorcycle != null) ? motorcycle : 5.0;
		this.electricVehicle = (electricVehicle != null) ? electricVehicle : 5.0;
		this.car = (car != null) ? car : 5.0;
		this.bus = (bus != null) ? bus : 5.0;
		this.other = (other != null) ? other : 5.0;
		this.rescueTimeOut = (rescueTimeOut != null) ? rescueTimeOut : 5.0;
		this.overtimeNotDispatch = (overtimeNotDispatch != null) ? overtimeNotDispatch : 2.0;
		this.overtimeNotDepart = (overtimeNotDepart != null) ? overtimeNotDepart : 5.0;
		this.notDepartMove = (notDepartMove != null) ? notDepartMove : 1.0;
	}
}
